package com.example.module.Common;


import com.example.module.enums.StatusCode;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;

/**
 * @author sed
 * @ClassName: BusinessException
 * @Description: 业务异常类, 使用场景:程序并未出现执行异常情况,人为抛出异常信息。
 * 例如：登录功能,账号不存在或密码错误时,可抛出一个业务异常,自定义异常信息
 * @date 2021-08-31
 */
@Data
public class BusinessException extends RuntimeException{

//    异常对应的描述信息
    private String message;

//    异常对应的返回码
    private StatusCode statusCode;

    public BusinessException(StatusCode statusCode) {
        this.statusCode = statusCode;
    }

    public BusinessException(String message) {
        this.message = message;
    }

    public BusinessException(StatusCode statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }
}